package Day08.Work1;
import java.util.Scanner;
public class Worker {
    private String name;
    private int year;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getYear() {
        return year;
    }
    public void setYear(int year) {
        this.year = year;
    }
    public Worker(String name, int year) {
        this.name = name;
        this.year = year;
    }
    public Worker() {
    }
}
class TestWork{
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in );
        Worker worker = new Worker();
        System.out.println("请录入工人姓名:");
        worker.setName(sc.next());
        System.out.println("请录入工人工龄:");
        worker.setYear(sc.nextInt());
        System.out.println("该工人对象的属性信息如下：");
        System.out.println("姓名:"+worker.getName());
        System.out.println("工龄："+worker.getYear());
    }
}
